define([
	"UtilDir/util",
	"UtilDir/tool",
    "UtilDir/org/selectOrg",
    "UtilDir/searchBlock",
	"Date","DateCN", "css!DateCss",
	"EasyUI","EasyUI-lang"
    ],function(Util, Tool, SelectOrg, SearchBlock){
    	
	var getQhCriteriaQueriesController = function(){
		return getServer() + "/qh/zfzxCriteriaQueries";
	};

	/**
	 * 页面初始化
	 */
	var init = function(){
		$("#uploadButton").on("click", function () {
			var uploadinput = document.getElementById("uploadFile");
			if (uploadinput.value == "") {
				Util.alert("上传前请先选择文件!");
				return;
			}
			var formData = new FormData();
            for(var i = 0; i < uploadinput.files.length; i++){
                formData.append('files', uploadinput.files[i]);
            }
			//formData.append("files", uploadinput.files);
			$.ajax({
				url: getQhCriteriaQueriesController() + "/importFile",
				data: formData,
				processData: false, //因为data值是FormData对象，不需要对数据做处理。
				contentType: false,
				type: "POST",
				success: function (data) {
					uploadinput.value = null;
					Util.alert(data);
				}
			});
		});

	};


	return {
		init:init
	};
});
